package com.tf_cut.backend.payment.controller;

import com.tf_cut.backend.payment.service.PaymentQueryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/backend/payment")
@Slf4j
public class PaymentQueryController {
    @Autowired
    private PaymentQueryService payment;

    @PostMapping("/queryPayment")
    public String queryPlatformGrantListInfo(@RequestParam("orderId") String orderId, @RequestParam("type") String type) {
        int code = 0;
        //type 查询类型，0：查询单笔，1：查询多笔
        if("0".equals(type)){
            code = payment.queryPaymentStatusByOrderId(orderId);
        }else if("1".equals(type)){
            code = payment.queryPaymentStatusByGrantId(orderId);
        }
        return code + "";
    }
}
